import { IPSAppMenuModel } from './ipsapp-menu-model';
import { IPSAppMenuItem } from '../../control/menu/ipsapp-menu-item';
import { PSAppMenuImpl } from '../../control/menu/psapp-menu-impl';

export class PSAppMenuModelImpl extends PSAppMenuImpl implements IPSAppMenuModel {
  protected psappmenuitems: IPSAppMenuItem[] | null = null;

  getPSAppMenuItems(): IPSAppMenuItem[] | null {
    if (this.psappmenuitems == null) {
      this.psappmenuitems = this.fillChildListModel(this.M.getPSAppMenuItems, 'control.menu.IPSAppMenuItem') as IPSAppMenuItem[];
    }
    return this.psappmenuitems;
  }

  get psAppMenuItems(): IPSAppMenuItem[] | null {
    return this.getPSAppMenuItems();
  }

  findPSAppMenuItem(objKey: any): IPSAppMenuItem | null {
    return this.getPSModel5('control.menu.IPSAppMenuItem', this.getPSAppMenuItems(), objKey) as IPSAppMenuItem;
  }
}
